@import "../../base.less";

@import "./_var.less";

@import "../../mixins/_index.less";

/** dropdwon-menu */
.@{prefix}-dropdown-menu {
  &__bar {
    position: relative;
    display: flex;
    height: 48px;
    background: @dropdown-menu-color-block;

    &::after {
      .hairline-bottom();
    }
  }

  &__item {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-width: 0;

    &.@{prefix}-is-active .@{prefix}-dropdown-menu__title {
      color: @dropdown-menu-primary-color;

      &::after {
        border-top-color: @dropdown-menu-primary-color;
        transform: translate(10px, -3px) rotate(180deg);
      }
    }

    &.@{prefix}-is-disabled .@{prefix}-dropdown-menu__title {
      color: @dropdown-menu-disabled-color;

      &::after {
        border-top-color: @dropdown-menu-disabled-color;
      }
    }
  }

  &__title {
    position: relative;
    box-sizing: border-box;
    max-width: 100%;
    padding: 0 @spacer;
    color: @dropdown-menu-level-1-color;
    font-size: @font-size-l;

    &::after {
      content: "";
      position: absolute;
      top: 50%;
      right: -5px;
      margin-top: -5px;
      border-width: 6px 5px;
      border-style: solid;
      border-color: @dropdown-menu-level-2-color transparent transparent;
      transition: transform 300ms ease;
      transform: translate(10px, 3px) rotate(0deg);
    }
  }
}

/** dropdown-item */
.@{prefix}-dropdown-item {
  position: fixed;
  right: 0;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 1000;
  overflow: hidden;

  &.@{prefix}-is-expanded &__content {
    transform: translate(0, 0);
  }

  &__content {
    position: absolute;
    max-height: @dropdown-item-height;
    left: 0;
    top: 0;
    width: 100%;
    bottom: 0;
    height: auto;
    display: flex;
    flex-direction: column;
    z-index: 1600;
    transform: translate(0, -100%);
  }

  &__cell {
    position: relative;
    width: 100%;
    padding: @cell-vertical-padding @cell-horizontal-padding;
    line-height: 24px;
    font-size: 16px;
    text-align: left;

    .@{prefix}-icon {
      float: left;
    }
  }

  &__content.@{prefix}-is-single &__cell::after {
    .hairline-bottom(@cell-border-color);

    left: @cell-horizontal-padding;
  }

  &__bd {
    flex: 1;
    background: @dropdown-menu-color-block;
    overflow: auto;
  }

  &__ft {
    background: @dropdown-menu-color-block;
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    height: 56px;

    &::before {
      z-index: 1;
      .hairline-top();
    }

    .@{prefix}-button {
      flex: 1;
      height: 100%;
      border-radius: 0;
      border: 0 none;

      &::after {
        display: none;
      }

      &--text {
        color: @dropdown-menu-level-1-color;
      }
    }
  }

  .@{prefix}-mask {
    position: absolute;
  }

  // .@{prefix}-cell {
  //   &-group {
  //     margin: 0;

  //     &-container {
  //       &::before,
  //       &::after {
  //         display: none;
  //       }
  //     }
  //   }

  //   &__value {
  //     overflow: hidden;
  //   }
  // }
  .@{prefix}-radio,
  .@{prefix}-checkbox {
    flex-direction: row-reverse;
    white-space: nowrap;
    padding-left: 0;

    &__content-wrap {
      width: 100%;
      display: flex;
      flex: 1;
      justify-content: space-between;
    }

    .@{prefix}-radio__content-title {
      flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }

  .@{prefix}-checkbox {
    &__icon-left {
      margin-right: 0;

      &.@{prefix}-is-checked+.@{prefix}-checkbox__content-wrap .@{prefix}-checkbox__content-title {
        color: @dropdown-menu-primary-color;
      }
    }

    &__content-title {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }

  .@{prefix}-dropdown-item__tree-group {
    flex: 1;
  }

  .@{prefix}-radio__content-wrap {
    margin-left: 0;
  }

  .@{prefix}-radio__content-inner {
    margin-top: 0;
  }

  /** 树形结构 */
  .@{prefix}-is-tree {
    max-height: @dropdown-item-height;

    .@{prefix}-dropdown-item__bd {
      display: flex;
      align-items: flex-start;
      overflow: hidden;

      .@{prefix}-dropdown-item__tree-group {
        flex: 1;
        margin: 0;
      }
    }

    .@{prefix}-check-group {
      .@{prefix}-dropdown-item__cell:not(:last-child)::after {
        display: none;
      }
    }

    .@{prefix}-checkbox__content-wrap {
      overflow: hidden;
    }

    .@{prefix}-dropdown-item__cell {
      background: none;

      &::after {
        display: none;
      }

      // &-group {
      //   height: 100%;

      //   &-container {
      //     height: 100%;
      //     overflow-y: auto;

      //     &::after {
      //       display: none;
      //     }
      //   }
      // }
    }

    &.@{prefix}-is-col2 .@{prefix}-dropdown-item__tree-group,
    &.@{prefix}-is-col3 .@{prefix}-dropdown-item__tree-group {
      width: 33.33%;

      &:nth-child(1) {
        background: @dropdown-menu-tree-col1-color;

        .@{prefix}-checkbox__icon-left,
        .@{prefix}-radio__default-shape {
          display: none;
        }
      }
    }

    &.@{prefix}-is-col3 .@{prefix}-dropdown-item__tree-group {
      width: 33.33%;

      &:nth-child(2) {
        background: @dropdown-menu-tree-col2-color;

        .@{prefix}-checkbox__icon-left {
          display: none;
        }
      }
    }
  }

  /** multi 多选多列情况 */
  .@{prefix}-is-multi {

    .@{prefix}-dropdown-item__bd {
      padding-top: @spacer;
      padding-bottom: @spacer;
      overflow-y: auto;
    }

    .@{prefix}-dropdown-item__cell {
      padding-top: @spacer;
      padding-bottom: @spacer;

      &:not(:last-child)::after {
        display: none;
      }
    }

    .@{prefix}-checkbox {
      &__icon-left {
        display: none;
      }

      &__content-title {
        font-size: @font-size-base;
      }

      &__content-wrap {
        background-color: @dropdown-menu-tree-col1-color;
        border-radius: @dropdown-item-border-radius;
        padding-left: @spacer;
        padding-right: @spacer;
        text-align: center;
        height: 38px;
        display: flex;
        justify-content: center;
        align-items: center;
      }

      .@{prefix}-is-checked+.@{prefix}-checkbox__content-wrap {
        background-color: @dropdown-menu-primary-color-1;
      }
    }

    .@{prefix}-check-group {
      display: flex;
      flex-wrap: wrap;
    }

    &.@{prefix}-is-col2 {
      .@{prefix}-dropdown-item__cell {
        width: 50%;
        display: inline-block;
        padding-left: @spacer;
        padding-right: @spacer;

        &-group {
          padding-left: @spacer;
          padding-right: @spacer;
        }
      }
    }

    &.@{prefix}-is-col3 {
      .@{prefix}-dropdown-item__cell {
        width: 33.33%;
        display: inline-block;
        padding-left: @spacer;
        padding-right: @spacer;

        &-group {
          padding-left: @spacer;
          padding-right: @spacer;
        }
      }
    }
  }

  /** dropRadio */
  &__radio {

    .@{prefix}-radio__default-shape {
      display: none;
    }

    &.@{prefix}-is-tick {

      .@{prefix}-icon-check {
        color: @dropdown-menu-primary-color;
      }
    }

    &.@{prefix}-is-checked {

      .@{prefix}-radio {
        &__content-title {
          color: @dropdown-menu-primary-color;
        }

        &__content-inner {
          font-size: 24px;
        }
      }
    }
  }
}
